<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-adx__wphorder}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item label="广告位" prop="channelTag">
          <el-input v-model="dataForm.channelTag" placeholder="channelTag" clearable></el-input>
        </el-form-item>
        <el-form-item label="订单状态" prop="status">
           <el-select v-model="dataForm.status" placeholder="订单状态" filterable clearable>
              <el-option v-for="item in statusList " :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue">
              </el-option>
            </el-select>
      </el-form-item>
      <el-form-item label="订单起始时间">
          <el-date-picker v-model="dataForm.stime" value-format="yyyy-MM-dd" type="date"
            placeholder="订单起始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="订单结束时间">
          <el-date-picker v-model="dataForm.etime" value-format="yyyy-MM-dd" type="date"
            placeholder="订单结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="info" @click="exportHandle()">{{ $t('export') }}</el-button>
        </el-form-item>
        <!-- <el-form-item>
          <el-button v-if="$hasPermission('adx:wphorder:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
        </el-form-item> -->
        <el-form-item>
          <el-button v-if="$hasPermission('adx:wphorder:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column prop="id" label="订单编号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="orderTime" label="下单时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="status" label="订单状态" header-align="center" align="center">
          <template slot-scope="scope">
            {{ $getDictLabel("wphStatus", scope.row.status) }}
          </template>
        </el-table-column>
        <!-- <el-table-column prop="orderSubStatus" label="订单子状态" header-align="center" align="center"></el-table-column> -->
        <el-table-column prop="newCustomerDesc" :show-overflow-tooltip='true' label="客户描述" header-align="center" align="center"></el-table-column>
        <el-table-column prop="settled" label="结算状态" header-align="center" align="center"></el-table-column>
        <el-table-column prop="channelTag" label="渠道标识" header-align="center" align="center"></el-table-column>
        <el-table-column prop="channelName" :show-overflow-tooltip='true' label="渠道名称" header-align="center" align="center"></el-table-column>
        <!-- <el-table-column prop="refundFlag" label="维权退款标识" header-align="center" align="center"></el-table-column> -->
        <!-- <el-table-column prop="statParam" label="" header-align="center" align="center"></el-table-column> -->
        <el-table-column prop="adCode"  label="广告推荐码" header-align="center" align="center"></el-table-column>
        <!-- <el-table-column prop="openId" label="openId" header-align="center" align="center"></el-table-column> -->
        <!-- <el-table-column prop="incrementRatio" label="" header-align="center" align="center"></el-table-column>
        <el-table-column prop="baseCommSettleRate" label="" header-align="center" align="center"></el-table-column> -->
        <el-table-column prop="baseComm" label="预告佣金" header-align="center" align="center"></el-table-column>
        <el-table-column prop="orderQuality" label="订单质量" header-align="center" align="center"></el-table-column>
        <!-- <el-table-column prop="baseCommSettleRateShow" label="" header-align="center" align="center"></el-table-column> -->
        <!-- <el-table-column prop="deductionAmount" label="" header-align="center" align="center"></el-table-column> -->
        <el-table-column prop="estiCommAmountAfterDeduction" label="佣金" header-align="center" align="center"></el-table-column>
        <el-table-column prop="createTime" label="创建时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="updateTime" label="更新时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="promoterId" label="推广者身份（1.二方，2，三方）" header-align="center" align="center"></el-table-column>
        <!-- <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
          <template slot-scope="scope">
            <el-button v-if="$hasPermission('adx:wphorder:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
            <el-button v-if="$hasPermission('adx:wphorder:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
          </template>
        </el-table-column> -->
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './wphorder-add-or-update'
import { getDictDataList } from '@/utils'
import { method } from 'lodash';
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/adx/wphorder/page',
        getDataListIsPage: true,
        exportURL: '/adx/wphorder/export',
        deleteURL: '/adx/wphorder',
        deleteIsBatch: true
      },
      dataForm: {
        id: ''
      },
      statusList:[]
    }
  },
  components: {
    AddOrUpdate
  },
  mounted() {
    this.getStatusList();
  },
  methods:{
    getStatusList() {
      this.statusList = getDictDataList("wphStatus")

    },
  }

}
</script>
